home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Acorn RISC PD-CD 1
/
Acorn RISC PD-CD 1.iso
/
languages
/
dde
/
_pc
/
h
/
os
< prev
next >
Wrap
Text File
|
1992-04-30
|
6KB
|
185 lines
(*
* Title : os.h
* Purpose: provides general access to low-level RISC OS routines
*
*)
(*
* This file is provided as an alternative to kernel.h
* It provides low-level access to RISC OS.
*
*)
# ifndef __os_h
# define __os_h
type os_regset_ptr = ^os_regset;
os_regset =
record
r : array[0..9] of integer (* only r0 - r9 matter for SWIs *)
end;
type os_error =
record
errnum : integer; (* error number *)
errmess : packed array[1..251] of char
(* error message (zero terminated) *)
end;
(* -------------------------------- os_swi ---------------------------------
* Perform the given SWI instruction, with the given registers loaded.
* An error results in a RISC OS error being raised.
* A NULL regset pointer means that no inout parameters are used
*
*)
procedure os_swi(swicode : integer; var regs : os_regset); extern;
const os_X = $00020000;
(* ------------------------------- os_swix ---------------------------------
* Perform the given SWI instruction, with the given registers loaded.
* Calls returning os_error* use the X form of the relevant SWI. If an error
* is returned then the os_error should be copied before further system calls
* are made. If no error occurs then NULL is returned.
*
*)
procedure os_swix(swicode : integer;
var regs : os_regset) : error; extern;
(* Important note: if swicode does not have the X bit set, then os_swi is
* called
* and these functions return NULL (regardless of whether an error was
* raised); please try to use X bit set swicodes to save confusion.
*
*)
(*
* SWIs with varying numbers of arguments and results. NULL result pointers
* mean that the result from that register is not required. The swi codes can
* be of the X form if required, as specified by swicode.
*
*)
procedure os_swi0(swicode : integer) : error; extern;
(* zero arguments and results *)
procedure os_swi1(swicode : integer;
r0 : integer) : error; extern;
procedure os_swi2(swicode : integer;
r0, r1 : integer) : error; extern;
procedure os_swi3(swicode : integer;
r0, r1, r2 : integer) : error; extern;
procedure os_swi4(swicode : integer;
r0, r1, r2, r3 : integer) : error; extern;
procedure os_swi6(swicode : integer;
r0, r1, r2, r3, r4, r5 : integer) : error; extern;
procedure os_swi1r(swicode : integer;
r0in : integer;
var r0out : integer) : error; extern;
procedure os_swi2r(swicode : integer;
r0in, r1in : integer;
var r0out, r1out : integer) : error; extern;
procedure os_swi3r(swicode : integer;
r0in, r1in, r2in : integer;
var r0out, r1out, r2out : integer) : error; extern;
procedure os_swi4r(swicode : integer;
r0in, r1in, r2in, r3in : integer;
var r0out, r1out, r2out,
r3out : integer) : error; extern;
procedure os_swi6r(swicode : integer;
r0in, r1in, r2in, r3in, r4in, r5in : integer;
var r0out, r1out, r2out,
r3out, r4out, r5out : integer) : error; extern;
(* ------------------------------- os_byte ---------------------------------
* Perform an OS_Byte SWIx, with x and y passed in register r1 and r2
* respectively.
*
*)
procedure os_byte(a : integer; var x, y : integer) : error; extern;
(* ------------------------------- os_word ---------------------------------
* Perform an OS_Word SWIx, with operation number given in "wordcode" and
* "p" pointing at necessary parameters to be passed in r1
*
*)
procedure os_word(wordcode : integer; p : pointer) : error; extern;
type os_gbpbstr_ptr = ^os_gbpbstr;
os_gbpbstr =
record
action : integer; (* specifies action of osgbpb *)
file_handle : integer; (* file handle, but may be used as a char *
* pointing to wildcarded dir-name *)
data_addr : pointer; (* memory address of data *)
number, seq_point, buf_len : integer;
wild_fld : string; (* points to wildcarded filename to match *)
reserved : array[0..2] of integer
(* space to allow treatment as reg_block *)
end;
(* -------------------------------- os_gbpb --------------------------------
* Perform an OS_GBPB SWI. os_gbpbstr should be used like an os_regset.
*
*)
procedure os_gbpb(b : os_gbpbstr_ptr) : error; extern;
type os_filestr_ptr = ^os_filestr;
os_filestr =
record
action : integer; (* action or object type if output data *)
name : string; (* pointer to filename or pathname *)
loadaddr, execaddr : integer;
(* load, exec addresses *)
start, _end : integer;
(* start address/length, end add./attributes *)
reserved : array[0..3] of integer
(* space to allow treatment as reg_block *)
end;
(* -------------------------------- os_file --------------------------------
* Perform an OS_FILE SWI.
*
*)
procedure os_file(b : os_filestr_ptr) : error; extern;
(* ------------------------------- os_args ---------------------------------
* Perform an OS_Args SWI.
*
*)
procedure os_args(r : os_regset_ptr) : error; extern;
(* ------------------------------ os_find ----------------------------------
* Perform an OS_Find SWI.
*
*)
procedure os_find(r : os_regset_ptr) : error; extern;
(* ------------------------------ os_cli -----------------------------------
* Perform an OS_CLI SWI.
*
*)
procedure os_cli(cmd : string) : error; extern;
(* ------------------------------ os_read_var_val --------------------------
* reads a named environment variable into a given buffer (of size "bufsize")
* If variable doesn't exist then buf points at a null string.
*)
procedure os_read_var_val(name : string;
buf : string; bufsize : integer) : error; extern;
# endif
(* end of os.h *)